package com.usian.controller;

import com.usian.config.FeignMember;
import com.usian.shop.entity.Member;
import com.usian.shop.utils.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/member")
public class ControllerMenent {
    @Autowired
    private FeignMember feignMember;
    @RequestMapping("/login")
    public ResponseResult login(@RequestBody Member member){
        return feignMember.login(member);
    }
    @GetMapping("/findAll")
    public Member findAll(@RequestParam("name") String name){
        return feignMember.findAll(name);
    }
    @PostMapping("/update")
    public ResponseResult update(@RequestBody Member member){
        try {
            feignMember.update(member);
            return ResponseResult.errorResult(200,"充值成功");
        } catch (Exception e) {
            e.printStackTrace();
            return ResponseResult.errorResult(500,"充值失败");
        }
    }
}
